﻿using Component.UI.View;
using FScrollPage;
using UnityEngine;

namespace Component.UI.Entity
{
    public class StageItem : FScrollItem
    {
        
        public ChallengeItem Child { get; set; }

        public delegate void ParentDelegate();

        public ParentDelegate click, pitch, over;

        public override void OnScrollClick()
        {
            if (selected)
            {
                selected = false;
                click.Invoke();
            }
        }

        public override void OnScrollPitch()
        {
            if (selected)
            {
                return;
            }
            base.OnScrollPitch();
            pitch.Invoke();
            Child.ScrollPager.MoveToItemID(ItemId);
        }

        public override void OnScrollOver()
        {
            base.OnScrollOver();
            over.Invoke();
        }
    }
}